import { axios } from '@/utils/request'

/**
 * api接口列表
 */
const api = {
  index: '/ad/index',
  detail: '/ad/detail',
  add: '/ad/add',
  edit: '/ad/edit',
  changeStatus: '/ad/changeStatus',
  del: '/ad/del',
  oldIndex: '/ad/old/index',
  oldBind: '/ad/old/bind',
  oldChangeStatus: '/ad/old/changeStatus',
  oldDel: '/ad/old/del',
  options: '/ad/options',
  oldOptions: '/ad/bookold/options',
  bookList: '/ad/book/options',
  bind: '/ad/bind',
  changeBind: '/ad/changeBind',
  oldBindImport: '/ad/old/importBind',
  departmentAll: 'ad/departmentall',
  linkList: 'ad/linkList',
  deleteLink: 'ad/deleteLink',
  optionList: '/wxwroksetting/optionList',
  adgetColor: '/ad/getColor',
  adsetColor: '/ad/setColor'
}

/**
 * 列表记录
 */
export function list(params) {
  return axios({
    url: api.index,
    method: 'get',
    params
  })
}

/**
 * 详情(详细信息)
 */
export function detail(params) {
  return axios({
    url: api.detail,
    method: 'get',
    params
  })
}

export function add(data) {
  return axios({
    url: api.add,
    method: 'post',
    data
  })
}

export function edit(data) {
  return axios({
    url: api.edit,
    method: 'post',
    data
  })
}

export function del(params) {
  return axios({
    url: api.del,
    method: 'get',
    params
  })
}

export function changeStatus(params) {
  return axios({
    url: api.changeStatus,
    method: 'get',
    params
  })
}

export function oldList(params) {
  return axios({
    url: api.oldIndex,
    method: 'get',
    params
  })
}

export function oldBind(data) {
  return axios({
    url: api.oldBind,
    method: 'post',
    data
  })
}

export function oldDel(data) {
  return axios({
    url: api.oldDel,
    method: 'post',
    data
  })
}

export function oldChangeStatus(params) {
  return axios({
    url: api.oldChangeStatus,
    method: 'get',
    params
  })
}

export function getOptions(data) {
  return axios({
    url: api.options,
    method: 'post',
    data
  })
}

export function getBookOptions(data) {
  return axios({
    url: api.bookList,
    method: 'post',
    data
  })
}

export function bindAd(data) {
  return axios({
    url: api.bind,
    method: 'post',
    data
  })
}

export function changeBind(data) {
  return axios({
    url: api.changeBind,
    method: 'post',
    data
  })
}

export function oldBindImport(data) {
  return axios({
    url: api.oldBindImport,
    method: 'post',
    data
  })
}

export function getDepartmentAll(params) {
  return axios({
    url: api.departmentAll,
    method: 'get',
    params
  })
}

export function getLinkList(params) {
  return axios({
    url: api.linkList,
    method: 'get',
    params
  })
}

export function deleteLink(params) {
  return axios({
    url: api.deleteLink,
    method: 'get',
    params
  })
}

export function getOldOptions(data) {
  return axios({
    url: api.oldOptions,
    method: 'post',
    data
  })
}

/**
 * 部门列表
 */
export function optionList(params) {
  return axios({
    url: api.optionList,
    method: 'get',
    params
  })
}

export function adgetColorEvent(params) {
  return axios({
    url: api.adgetColor,
    method: 'get',
    params
  })
}
export function adsetColorEvent(data) {
  return axios({
    url: api.adsetColor,
    method: 'post',
    data
  })
}